home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Power Programmierung
/
Power-Programmierung (Tewi)(1994).iso
/
fortran
/
mslang
/
f32int
/
funkey.for
next >
Wrap
Text File
|
1993-06-25
|
2KB
|
56 lines
include 'int86qq.fi'
program getkeys
character spec_key*2
logical get_key/.true./
integer*2 i,j,getch
data spec_key/'F '/
write(*,'(1x,a)') 'ENTER FUNCTION AND ARROW KEYS OR ESCAPE '
i=1
do while (get_key)
j=getch() ! Get SPECIAL KEY
if (j.eq.27) then
write(*,*) 'ESC key pressed'
elseif (j.le.13) then
if (j.eq.13) get_key=.false. ! ENTER key pressed - exit loop
if (j.eq.0) then ! *** SPECIAL KEY LOGIC ***
j=getch()
if (j.ge.59.AND.j.le.68) then ! test for function key
spec_key='F '
if (j.lt.68) then
write(spec_key(2:2),'(i1)') j-58
write(*,*) spec_key
else
write(*,*) 'F10'
endif
elseif (j.eq.72) then
write(*,*) 'Up arrow'
elseif (j.eq.77) then
write(*,*) 'Right arrow'
elseif (j.eq.80) then
write(*,*) 'Down arrow'
elseif (j.eq.75) then
write(*,*) 'Left arrow'
endif
endif
else
write(*,*) 'ASCII = ',char(j)
endif
enddo
end
c The getch function gets a character from Standard Input without echo.
c When a special key is pressed (like a function key or arrow key) this
c function returns a 0. This function should then be called again to
c obtain the scan code. From this returned scan code, you can determine
c which special key was pressed.
integer*2 function getch
include 'int86qq.fd'
record /regs$info/ in,out
in.bregs.ah=#08 ! Function 7 - STDIN Input (without echo)
call int86qq(int2(#21),in,out) ! INT 21H
getch=out.bregs.al ! Input data returned in AL
return
end